/*******************************************************************************
 * Copyright (c) 2010, 2010 Xbeam Project and ChenZhiKong.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 *******************************************************************************/
package org.bellusoft.xbeam.framework.resolve;

import java.util.Map;

/**
 *Resolve Result of a module in one resolve process.
 *
 *@see Resolver
 */
public interface ModuleResolveResult {
	/**
	 * Return Wire information of Require Module dependencies.
	 * 
	 * <p>
	 * <strong>contract</strong>
	 * <ol>
	 * <li>If {@link #getState()} return <tt>Successed</tt>, then result <em>must not<em> be <code>null</code>.</li>
	 * <li>If {@link #getState()} return <tt>Failed</tt>,<tt>Resolved</tt>,<tt>Confirming</tt>, then result must be <code>null</code>.</li>
	 * </ol>
	 * 
	 * @return wire information of Require Modules.
	 */
	public Map<RequiredModule, ModuleResolveData> getModuleWires() ; 
	/**
	 * Return Wire information of import package dependencies.
	 * 
	 * <p>
	 * <strong>contract</strong>
	 * <ol>
	 * <li>If {@link #getState()} return <tt>Successed</tt>, then result <em>must not<em> be <code>null</code>.</li>
	 * <li>If {@link #getState()} return <tt>Failed</tt>,<tt>Resolved</tt>,<tt>Confirming</tt>, then result must be <code>null</code>.</li>
	 * </ol>
	 * 
	 * @return wire information of import packages.
	 */
	public Map<ImportPackage, ExportPackage> getPackageWires() ; 
	
	/**
	 * Return resolve result type. 
	 * 
	 * @return resolve state.
	 * @see ResolveState
	 */
	public ResolveState getState() ; 
	
	/**
	 * Return Wire information of import package dependencies.
	 * 
	 * <p>
	 * <strong>contract</strong>
	 * <ol>
	 * <li>If {@link #getState()} return <tt>Successed</tt>,<tt>Resolved</tt> and <tt>Confirming</tt> then result <em>must<em> be <code>null</code>.</li>
	 * <li>If {@link #getState()} return <tt>Failed</tt>, then result <em>must not</em> be <code>null</code>.</li>
	 * </ol>
	 * 
	 * @return wire information of import packages.
	 */
	public String getFailedReason() ; 
	
	/**
	 *Resolve result type of a module in the resolving process return this <code>ModuleResolveResult</code>
	 */
	public enum ResolveState {
		/**
		 *Type represent this module can not be resolved in this resolving process. 
		 */
		Failed, 
		/**
		 *Type represent this module is resolved successfully in this resolving process. 
		 */
		Successed, 
		/**
		 *Type represent this module is resolved in another process and has already been confirmed.
		 */
		Resolved, 
		/**
		 * The module is resolved in another process and has not been confirmed yet.
		 */
		Confirming
	} ; 
}
